package com.vueblog.dao;

import com.vueblog.po.Blog;
import com.vueblog.vo.DetailBlog;
import com.vueblog.vo.SimpleBlog;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

@Mapper
public interface BlogDao {
    List<SimpleBlog> findByTitleAndTitleAndPublished(Blog blog);

    int saveBlog(Blog blog);

    int deleteBlog(int id);

    //只有单个查询才会返回content
    //管理员编辑更新的blog
    //和findShowBlogById的区别在于是否需要published=true
    DetailBlog findDetailBlogById(int id);

    //用户界面展示的blog
    DetailBlog findShowBlogById(int id);

    int updateBlog(Blog blog);

    List<DetailBlog> findAllForIndex();

    //ShowBlog都需要判断published=true
    List<DetailBlog> findShowBlogsByTypeId(int typeId);

    void updateView(int id);

    int updateCommentCount(int i,int id);

    //返回年份列表
    List<String> findGroupYear();

    //返回该年可以展示的博客
    List<SimpleBlog> findShowBlogByYear(String year);

    //返回可以展示的博客数量
    int countShowBlog();

    List<DetailBlog> findShowBlogByTitleOrContent(String keyword);

}
